import request from '@/utils/request'

export const fetchZhiChuType = () => {
  return request({
    method: 'GET',
    url: '/zhiChutype'
  })
}
export const fetchShouRuType = () => {
  return request({
    method: 'GET',
    url: '/shouRuType'
  })
}

export const addZhiChuCategory = (data) => {
  return request({
    method: 'POST',
    url: '/zhiChutype',
    data
  })
}


export const addShouRuCategory = (data) => {
  return request({
    method: 'POST',
    url: '/shouRuType',
    data
  })
}
//PUT    /posts/:id
export const updateZhiChuCategory = (id, data) => {
  return request({
    method: 'PATCH',
    url: `/zhiChutype/${id}`,
    data
  })
}

export const updateShouRuCategory = (id, data) => {
  return request({
    method: 'PATCH',
    url: `/shouRuType/${id}`,
    data
  })
}

export const fetchMingXiData = (params = {}) => {
  params._page = params.pageNumber || 1 // 第几页
  params._limit = params.pageSize || 10 //每页多少条
  params.date && (params.date_like = params.date) //  http://192.168.1.103:1236/api/mingxi?_page=1&_limit=300&date_like=2024-04
  delete params.pageNumber
  delete params.pageSize
  delete params.date

  return request({
    method: 'GET',
    url: '/mingxi',
    query: params
  })
}

